package com.xiaohu.demo.utils.longLink.server;

import java.util.HashMap;
import java.util.Map;

public class Cache {
	public static Map<String,Object> cache = new HashMap<String,Object>();
	
	public static String getStringValue(String key) {
		if(key==null || "".equals(key)) {
			return "";
		}
		return String.valueOf(cache.get(key));
	}
	
	public static void addAttrbute(String key,Object value) {
		cache.put(key, value);
	}
	
	public static String getKeyString() {
		String keyStr = "";
		int i = 0;
		for(String key : cache.keySet()){
			keyStr+= key;
			if(i<cache.keySet().size()-1) {
				keyStr+=",";
			}
			i++;
		}
		return keyStr;
	}
	
	public static void removeKey(String key) {
		cache.remove(key);
	}
	
	public static void clear() {
		cache.clear();
	}
}
